﻿#ifndef ANDYRP_SHADOWCASTER_INCLUDED
#define ANDYRP_SHADOWCASTER_INCLUDED

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
#include "Assets/Shaders/Util/Common.hlsl"
#include "Assets/Shaders/Util/Surface.hlsl"

CBUFFER_START(_ShadowCasterBuffer)
    float _ShadowBias;
CBUFFER_END

struct VertexInput
{
	float4 pos:POSITION;
	UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct VertexOutput
{
	float4 clipPos:SV_POSITION;
};


VertexOutput ShadowCasterVertprogram(VertexInput input)
{
	VertexOutput output;
	UNITY_SETUP_INSTANCE_ID(input);
	float4 worldPos = mul(unity_ObjectToWorld,input.pos);
	output.clipPos = mul(unity_MatrixVP, worldPos);

	//output.clipPos.z = max(output.clipPos.z, output.clipPos.w);
#if UNITY_REVERSED_Z
        output.clipPos.z -= _ShadowBias;
		output.clipPos.z =
			min(output.clipPos.z, output.clipPos.w * UNITY_NEAR_CLIP_VALUE);
#else
    output.clipPos.z += _ShadowBias;
    output.clipPos.z =
			max(output.clipPos.z, output.clipPos.w * UNITY_NEAR_CLIP_VALUE);
	#endif

	return output;
}

float4 ShadowCasterFragtprogram(VertexOutput input) :SV_TARGET
{
	return 0;
}



#endif
